<%-- 
    Document   : index
    Created on : May 29, 2011, 9:41:46 PM
    Author     : tawfeeq
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="java.io.*" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%
        String dbUrl = "jdbc:odbc:JavaWeb";
try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection con = DriverManager.getConnection(dbUrl,"project","project");
      %>
        
<script type="text/javascript">
var collegeID = new Array();
var semesterID = new Array();
var collegeSemester = new Array();
var courseID = new Array();
var semsterCourse = new Array();

<%
String sql = "SELECT College_ID" +
        " FROM Colleges";
      Statement s = con.createStatement();
      ResultSet rs = s.executeQuery(sql);
      int count = 0;
      while(rs.next()){  
%>
collegeID[<%=count%>]='<%=rs.getString(1)%>';    

<%
count++;
}
      
sql = "SELECT Semester_ID,College_ID"+
        " FROM Schedule " ;
      Statement s1 = con.createStatement();
      ResultSet rs1 = s1.executeQuery(sql);
      count = 0;
      while(rs1.next()){ 
    %>
        semesterID[<%=count%>]='<%=rs1.getString(1)%>';
        collegeSemester[<%=count%>]='<%=rs1.getString(2)%>'; 
<%count++;
}
      
count = 0;
sql = "SELECT Semester_ID,Course_ID "+
        " FROM Schedule " ;
Statement s2 = con.createStatement();
      ResultSet rs2 = s2.executeQuery(sql);
      count = 0;
      while(rs2.next()){
          %>
                    courseID[<%=count%>]='<%=rs2.getString(2)%>';
                        semsterCourse[<%=count%>]='<%=rs2.getString(1)%>'; 
<%count++;
}        
}
catch(Exception e){
    System.out.println("error "+e);
}            

%>
    function loadCity(){
    var count = 0;
    param="";
    cityLabel='';
    stationLabel='';
    transLabel='';
    document.getElementById("cityID").options[0] = new Option("- Select City -","");
    for(i=0;i<cityID.length;i++){
        document.getElementById("cityID").options[count+1] = new Option(cityDesc[i],cityID[i]);
        count++;
    }
}
</script>
    </head>
    <body>

    </body>
</html>
